package com.neuedu.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;

import com.neuedu.domain.Userinfo;
import com.neuedu.mapper.UserinfoMapper;
import com.neuedu.service.UserinfoService;
import com.neuedu.util.SqlSessionFactoryUtil;

public class UserinfoServiceImpl implements UserinfoService{
	SqlSession sqlSession = SqlSessionFactoryUtil.getInstance().getSqlSession();
	UserinfoMapper um = sqlSession.getMapper(UserinfoMapper.class);
	@Override
	public int regEmailCheck(String email) {
		int count = um.regEmailCheck(email);
		return count;
	}
	@Override
	public int addUserinfo(Userinfo userinfo) {
		int count = um.addUserinfo(userinfo);
		sqlSession.commit();
		return count;
	}
	@Override
	public Userinfo loginCheck(Userinfo userinfo) {
		// TODO Auto-generated method stub
		return um.loginCheck(userinfo);
	}
	@Override
	public int updatepass(Userinfo userinfo) {
		int count = um.updatepass(userinfo);
		sqlSession.commit();
		return count;
	}
	@Override
	public int uploadHeadImg(Userinfo userinfo) {
		int count = um.uploadHeadImg(userinfo);
		sqlSession.commit();
		return count;
		
	}
	@Override
	public int activeMail(String mailcode) {
		int count = um.activeMail(mailcode);
		sqlSession.commit();
		return count;
	}
	@Override
	public List<Map<String, Object>> selectArticle(int authorid) {		
		return um.selectArticle(authorid);
	}
	@Override
	public List<Map<String, Object>> selectMineTie(int authorid) {
		// TODO Auto-generated method stub
		return um.selectMineTie(authorid);
	}
	@Override
	public List<Map<String, Object>> selectMineaAns(int authorid) {
		// TODO Auto-generated method stub
		return um.selectMineaAns(authorid);
	}
	@Override
	public int upMyMessage(Userinfo userinfo) {
		int count = um.upMyMessage(userinfo);
		sqlSession.commit();
		return count;
	}
	@Override
	public Userinfo upEmail(String update_email) {
		// TODO Auto-generated method stub
		return um.upEmail(update_email);
	}
	@Override
	public List<Map<String, Object>> selectMyMessage(int id) {
		// TODO Auto-generated method stub
		return um.selectMyMessage(id);
	}
	@Override
	public Userinfo homeCheck(int id) {
		// TODO Auto-generated method stub
		return um.homeCheck(id);
	}
	

}
